package com.ynet.eq.haiqing.module.operator.service.impl;

import com.ynet.eq.haiqing.common.utils.GenerateMessageIdUtil;
import com.ynet.eq.haiqing.module.bean.MqttBaseReq;
import com.ynet.eq.haiqing.module.mqtt.MqttClientService;
import com.ynet.eq.haiqing.module.operator.req.UnlockReq;
import com.ynet.eq.haiqing.module.operator.service.OperatorService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author 胡超雄
 * @date 2021/7/7 14:28
 * @desc
 */
@Slf4j
@Service
public class OperatorServiceImpl  implements OperatorService {

    /**
     * mqtt  客户端
     */
    @Resource
    private MqttClientService mqttClientService;

    @Override
    public void unlock(UnlockReq req) {

        MqttBaseReq baseReq = new MqttBaseReq();
        baseReq.setId(req.getId());
        baseReq.setOperator("Unlock");
        baseReq.setMessageId(GenerateMessageIdUtil.generateMessageId());
        baseReq.setInfo(req);
        mqttClientService.doExecute(baseReq);
    }
}
